#include "reg52.h"



sfr AUXR = 0x8e;

void Delay(unsigned int t)
{
	while(t--);
}

void SendUART(unsigned char date)
{
	SBUF = date;
	while (TI == 0);//当TI等于1了，表示串口完成发送，跳出循环
	TI = 0;
}

void InitUART()
{
	TMOD = 0x20;
	SCON = 0x50;
	TH1 = 0xfd;
	TL1 = 0xfd;
	TR1 = 1;
	AUXR = 0x00;
	EA = 1;
	ES = 1;


}

unsigned char dat = 0;

void 	ServeUART()	interrupt 4
{
	if (RI == 1)
	{
		RI = 0;
		dat = SBUF;
		SendUART(dat + 1);
	}
}


void main()
{
	InitUART();
	Delay(500);
	SendUART(0x5a);
	SendUART(0xa5);

	while (1)
	{

	}
}